package online.chazi.bootplus.biz.utils.exceptions;

import online.chazi.bootplus.biz.utils.IReplyCode;

/**
 * 说明：作者很懒，什么都没留下
 * Created by 叉子同学 on 2020-04-11 18:23
 */
public class BizException extends Exception {
    private Enum<?> anEnumReplyCode;

    public BizException() {
    }

    public BizException(Enum<?> anEnumReplyCode) {
        verifyReplyCodeEnum(anEnumReplyCode);
        this.anEnumReplyCode = anEnumReplyCode;
    }

    private void verifyReplyCodeEnum(Enum<?> anEnumReplyCode) {
        if (!(anEnumReplyCode instanceof IReplyCode))
            throw new IllegalArgumentException("枚举必须实现 IReplyCode 接口！");
    }

    public Enum<?> getAnEnumReplyCode() {
        return anEnumReplyCode;
    }

    public void setAnEnumReplyCode(Enum<?> anEnumReplyCode) {
        verifyReplyCodeEnum(anEnumReplyCode);
        this.anEnumReplyCode = anEnumReplyCode;
    }

}
